*** Settings ***
Test Setup        common_test_setup    @{crm_recordmanage_menu}
Test Teardown     common_test_teardown
Resource          ../../resource/workflow.txt
Resource          ../../resource/customerservice/recordmanage.txt
Resource          ../../testdata/${testenv}/customerservice/recordmanage.txt
Resource          ../../resource/cluemanage/driverclue_resource.txt
Resource          ../../resource/cluemanage/consignor_resource.txt
Resource          ../../resource/customerservice/qualitycheckcenter.txt

*** Test Cases ***
record_add_consignorclue
    @{t}    Copy List    ${record_add_consignorclue}
    ${now}    get time    epoch
    ${name}    catenate    SEPARATOR=_    @{t}[4]    ${now}
    ${cluename}    catenate    SEPARATOR=_    @{t}[6]    ${now}
    @{l1}    evaluate    list(@{t})[0:4]
    @{l2}    evaluate    list(@{t})[7:]
    ${recordname}    kw_crm_record_add    @{l1}    ${name}    @{t}[5]    ${cluename}    @{l2}
    kw_crm_customerservice_search    name=${name}
    table_resultnum_should_be    1
    ${tmpid}    Get Table Element Text    1    1
    Set global Variable    ${record_id}    ${tmpid}
    context_menu_select    @{t}[1]
    Click Menu Into Page    @{consignor_menu}
    wait_table_loaded
    kw_crm_search_consignorclue    \    公海    ${cluename}
    table_resultnum_should_be    1
    context_menu_select    @{tenant1}
    Click Menu Into Page    @{crm_recordmanage_menu}

record_add_driverclue
    @{t}    Copy List    ${record_add_driverclue}
    ${now}    get time    epoch
    ${name}    catenate    SEPARATOR=_    @{t}[4]    ${now}
    ${cluename}    catenate    SEPARATOR=_    @{t}[6]    ${now}
    @{l2}    evaluate    list(@{t})[7:]
    ${recordname}    kw_crm_record_add    @{t}[0]    @{t}[1]    @{t}[2]    @{t}[3]    ${name}
    ...    @{t}[5]    ${cluename}    @{l2}
    kw_crm_customerservice_search    name=${name}
    table_resultnum_should_be    1
    context_menu_select    @{t}[1]
    Click Menu Into Page    @{driverclue_menu}
    wait_table_loaded
    search_driverclue    \    \    ${cluename}    公海
    table_resultnum_should_be    1
    context_menu_select    @{tenant1}
    Click Menu Into Page    @{crm_recordmanage_menu}

record_modify
    Depends On Test Success    record_add_consignorclue
    @{t}    Copy List    ${record_modify}
    kw_crm_customerservice_search    record_NO=${record_id}
    kw_crm_record_modify    @{t}
    common_first_row_operate    ${False}    编辑
    wait page loaded
    ${value}    Get Value new    ${loc_crm_02_detail_describe}
    Should Be Equal    ${value}    @{t}[5]
    click element new    ${loc_common_close}
    wait_modal_invisible

record_quality_check
    Depends On Test Success    record_add_consignorclue
    @{t}    Copy List    ${record_quality_check}
    kw_crm_customerservice_search    record_NO=${record_id}
    kw_crm_record_quality_check    @{t}
    Click Menu Into Page    @{crm_qc_center_menu}
    kw_crm_qc_search    ${record_id}
    table_resultnum_should_be    1
    Click Menu Into Page    @{crm_recordmanage_menu}
